package tr.edu.metu.is.mega.client.service;

import java.util.List;

import tr.edu.metu.is.mega.common.dto.CourseDTO;
import tr.edu.metu.is.mega.common.dto.CourseStudentDTO;
import tr.edu.metu.is.mega.common.dto.TeamDTO;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
 * Gwt course service.
 */
@RemoteServiceRelativePath("../GwtCourseService")
public interface GwtCourseService extends RemoteService {

    /**
     * Utility class for simplifying access to the instance of async service.
     */
    public static class Util {

        private static GwtCourseServiceAsync instance;

        public static GwtCourseServiceAsync getInstance() {
            if (instance == null) {
                instance = GWT.create(GwtCourseService.class);
            }
            return instance;
        }
    }

    /**
     * Creates a course record.
     * 
     * @param course user instance
     * @return created user instance
     */
    CourseDTO createCourse(CourseDTO course);

    /**
     * Updates a course record.
     * 
     * @param course course instance
     * @return updated course instance
     */
    CourseDTO updateCourse(CourseDTO course);

    /**
     * Deletes a course record
     * 
     * @param course to be deleted
     */
    void deleteCourse(CourseDTO course);

    /**
     * Queries course matching given criteria.
     * 
     * @param filter filter instance
     * @return list of courses
     */
    List<CourseDTO> getCourses(CourseDTO filter);

    CourseDTO updateTeam(TeamDTO team);

    public boolean exportToGoogleCalendar(String userName, String password, CourseDTO course);

    public List<CourseStudentDTO> pullStudentsFromMETUOnline(CourseDTO course);

}
